/******************************************************************************
 * Copyright 2023 The Apollo Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *****************************************************************************/

#pragma once

#include "modules/canbus_vehicle/x3epro/proto/x3epro.pb.h"
#include "modules/drivers/canbus/can_comm/protocol_data.h"

namespace apollo {
namespace canbus {
namespace x3epro {

class Adslampcommand309 : public ::apollo::drivers::canbus::ProtocolData<
                    ::apollo::canbus::X3epro> {
 public:
  static const int32_t ID;

  Adslampcommand309();

  uint32_t GetPeriod() const override;

  void Parse(const std::uint8_t* bytes, int32_t length,
                     X3epro* chassis) const override;

  void UpdateData(uint8_t* data) override;
  void UpdateData_Heartbeat(uint8_t* data) override;

  void Reset() override;

  // config detail: {'bit': 0, 'enum': {0: 'ORIN_CLEANERRELAY_DISABLE', 1: 'ORIN_CLEANERRELAY_ENABLE'}, 'is_signed_var': False, 'len': 1, 'name': 'Orin_CleanerRelay', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': 'bit', 'precision': 1.0, 'type': 'enum'}
  Adslampcommand309* set_orin_cleanerrelay(Ads_lampcommand_309::Orin_cleanerrelayType orin_cleanerrelay);

  // config detail: {'bit': 8, 'enum': {0: 'TURN_RIGHT_LIGHT_COMMAND_DISABLE', 1: 'TURN_RIGHT_LIGHT_COMMAND_ENABLE'}, 'is_signed_var': False, 'len': 1, 'name': 'Turn_Right_Light_Command', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': 'bit', 'precision': 1.0, 'type': 'enum'}
  Adslampcommand309* set_turn_right_light_command(Ads_lampcommand_309::Turn_right_light_commandType turn_right_light_command);

  // config detail: {'bit': 9, 'enum': {0: 'TURN_LEFT_LIGHT_COMMAND_DISABLE', 1: 'TURN_LEFT_LIGHT_COMMAND_ENABLE'}, 'is_signed_var': False, 'len': 1, 'name': 'Turn_Left_Light_Command', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': 'bit', 'precision': 1.0, 'type': 'enum'}
  Adslampcommand309* set_turn_left_light_command(Ads_lampcommand_309::Turn_left_light_commandType turn_left_light_command);

  // config detail: {'bit': 10, 'enum': {0: 'HORN_COMMAND_DISABLE', 1: 'HORN_COMMAND_ENABLE'}, 'is_signed_var': False, 'len': 1, 'name': 'Horn_Command', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': 'bit', 'precision': 1.0, 'type': 'enum'}
  Adslampcommand309* set_horn_command(Ads_lampcommand_309::Horn_commandType horn_command);

  // config detail: {'bit': 11, 'enum': {0: 'DAYLAMP_COMMAND_OFF', 1: 'DAYLAMP_COMMAND_ON'}, 'is_signed_var': False, 'len': 1, 'name': 'DayLamp_Command', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': 'bit', 'precision': 1.0, 'type': 'enum'}
  Adslampcommand309* set_daylamp_command(Ads_lampcommand_309::Daylamp_commandType daylamp_command);

  // config detail: {'bit': 12, 'enum': {0: 'HEADBEAM_COMMAND_OFF', 1: 'HEADBEAM_COMMAND_ON'}, 'is_signed_var': False, 'len': 1, 'name': 'HeadBeam_Command', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': 'bit', 'precision': 1.0, 'type': 'enum'}
  Adslampcommand309* set_headbeam_command(Ads_lampcommand_309::Headbeam_commandType headbeam_command);

  // config detail: {'bit': 13, 'enum': {0: 'POSITIONLAMP_COMMAND_OFF', 1: 'POSITIONLAMP_COMMAND_ON'}, 'is_signed_var': False, 'len': 1, 'name': 'PositionLamp_Command', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': 'bit', 'precision': 1.0, 'type': 'enum'}
  Adslampcommand309* set_positionlamp_command(Ads_lampcommand_309::Positionlamp_commandType positionlamp_command);

  // config detail: {'bit': 14, 'enum': {0: 'FROGLAMP_COMMAND_OFF', 1: 'FROGLAMP_COMMAND_ON'}, 'is_signed_var': False, 'len': 1, 'name': 'FrogLamp_Command', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': 'bit', 'precision': 1.0, 'type': 'enum'}
  Adslampcommand309* set_froglamp_command(Ads_lampcommand_309::Froglamp_commandType froglamp_command);

  // config detail: {'bit': 51, 'is_signed_var': False, 'len': 4, 'name': 'AliveCounter', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': '', 'precision': 1.0, 'type': 'int'}
  Adslampcommand309* set_alivecounter(int alivecounter);

  // config detail: {'bit': 63, 'is_signed_var': False, 'len': 8, 'name': 'CheckSum', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': '', 'precision': 1.0, 'type': 'int'}
  Adslampcommand309* set_checksum(int checksum);

 private:

  // config detail: {'bit': 0, 'enum': {0: 'ORIN_CLEANERRELAY_DISABLE', 1: 'ORIN_CLEANERRELAY_ENABLE'}, 'is_signed_var': False, 'len': 1, 'name': 'Orin_CleanerRelay', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': 'bit', 'precision': 1.0, 'type': 'enum'}
  void set_p_orin_cleanerrelay(uint8_t* data, Ads_lampcommand_309::Orin_cleanerrelayType orin_cleanerrelay);

  // config detail: {'bit': 8, 'enum': {0: 'TURN_RIGHT_LIGHT_COMMAND_DISABLE', 1: 'TURN_RIGHT_LIGHT_COMMAND_ENABLE'}, 'is_signed_var': False, 'len': 1, 'name': 'Turn_Right_Light_Command', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': 'bit', 'precision': 1.0, 'type': 'enum'}
  void set_p_turn_right_light_command(uint8_t* data, Ads_lampcommand_309::Turn_right_light_commandType turn_right_light_command);

  // config detail: {'bit': 9, 'enum': {0: 'TURN_LEFT_LIGHT_COMMAND_DISABLE', 1: 'TURN_LEFT_LIGHT_COMMAND_ENABLE'}, 'is_signed_var': False, 'len': 1, 'name': 'Turn_Left_Light_Command', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': 'bit', 'precision': 1.0, 'type': 'enum'}
  void set_p_turn_left_light_command(uint8_t* data, Ads_lampcommand_309::Turn_left_light_commandType turn_left_light_command);

  // config detail: {'bit': 10, 'enum': {0: 'HORN_COMMAND_DISABLE', 1: 'HORN_COMMAND_ENABLE'}, 'is_signed_var': False, 'len': 1, 'name': 'Horn_Command', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': 'bit', 'precision': 1.0, 'type': 'enum'}
  void set_p_horn_command(uint8_t* data, Ads_lampcommand_309::Horn_commandType horn_command);

  // config detail: {'bit': 11, 'enum': {0: 'DAYLAMP_COMMAND_OFF', 1: 'DAYLAMP_COMMAND_ON'}, 'is_signed_var': False, 'len': 1, 'name': 'DayLamp_Command', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': 'bit', 'precision': 1.0, 'type': 'enum'}
  void set_p_daylamp_command(uint8_t* data, Ads_lampcommand_309::Daylamp_commandType daylamp_command);

  // config detail: {'bit': 12, 'enum': {0: 'HEADBEAM_COMMAND_OFF', 1: 'HEADBEAM_COMMAND_ON'}, 'is_signed_var': False, 'len': 1, 'name': 'HeadBeam_Command', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': 'bit', 'precision': 1.0, 'type': 'enum'}
  void set_p_headbeam_command(uint8_t* data, Ads_lampcommand_309::Headbeam_commandType headbeam_command);

  // config detail: {'bit': 13, 'enum': {0: 'POSITIONLAMP_COMMAND_OFF', 1: 'POSITIONLAMP_COMMAND_ON'}, 'is_signed_var': False, 'len': 1, 'name': 'PositionLamp_Command', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': 'bit', 'precision': 1.0, 'type': 'enum'}
  void set_p_positionlamp_command(uint8_t* data, Ads_lampcommand_309::Positionlamp_commandType positionlamp_command);

  // config detail: {'bit': 14, 'enum': {0: 'FROGLAMP_COMMAND_OFF', 1: 'FROGLAMP_COMMAND_ON'}, 'is_signed_var': False, 'len': 1, 'name': 'FrogLamp_Command', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': 'bit', 'precision': 1.0, 'type': 'enum'}
  void set_p_froglamp_command(uint8_t* data, Ads_lampcommand_309::Froglamp_commandType froglamp_command);

  // config detail: {'bit': 51, 'is_signed_var': False, 'len': 4, 'name': 'AliveCounter', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': '', 'precision': 1.0, 'type': 'int'}
  void set_p_alivecounter(uint8_t* data, int alivecounter);

  // config detail: {'bit': 63, 'is_signed_var': False, 'len': 8, 'name': 'CheckSum', 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|0]', 'physical_unit': '', 'precision': 1.0, 'type': 'int'}
  void set_p_checksum(uint8_t* data, int checksum);

  Ads_lampcommand_309::Orin_cleanerrelayType orin_cleanerrelay(const std::uint8_t* bytes, const int32_t length) const;

  Ads_lampcommand_309::Turn_right_light_commandType turn_right_light_command(const std::uint8_t* bytes, const int32_t length) const;

  Ads_lampcommand_309::Turn_left_light_commandType turn_left_light_command(const std::uint8_t* bytes, const int32_t length) const;

  Ads_lampcommand_309::Horn_commandType horn_command(const std::uint8_t* bytes, const int32_t length) const;

  Ads_lampcommand_309::Daylamp_commandType daylamp_command(const std::uint8_t* bytes, const int32_t length) const;

  Ads_lampcommand_309::Headbeam_commandType headbeam_command(const std::uint8_t* bytes, const int32_t length) const;

  Ads_lampcommand_309::Positionlamp_commandType positionlamp_command(const std::uint8_t* bytes, const int32_t length) const;

  Ads_lampcommand_309::Froglamp_commandType froglamp_command(const std::uint8_t* bytes, const int32_t length) const;

  int alivecounter(const std::uint8_t* bytes, const int32_t length) const;

  int checksum(const std::uint8_t* bytes, const int32_t length) const;

 private:
  Ads_lampcommand_309::Orin_cleanerrelayType orin_cleanerrelay_;
  Ads_lampcommand_309::Turn_right_light_commandType turn_right_light_command_;
  Ads_lampcommand_309::Turn_left_light_commandType turn_left_light_command_;
  Ads_lampcommand_309::Horn_commandType horn_command_;
  Ads_lampcommand_309::Daylamp_commandType daylamp_command_;
  Ads_lampcommand_309::Headbeam_commandType headbeam_command_;
  Ads_lampcommand_309::Positionlamp_commandType positionlamp_command_;
  Ads_lampcommand_309::Froglamp_commandType froglamp_command_;
  int alivecounter_;
  int checksum_;
};

}  // namespace x3epro
}  // namespace canbus
}  // namespace apollo


